package com.game.packet;


import com.game.util.LogUtil;

/**
 * @author sig
 * @since 2016/9/25
 */
public class PacketMg implements PacketI {

    @Override
    public void sendPack(Packet req, Packet res) {
        if (null == req || null == req.getChannel()) {
            LogUtil.console.error("Oh no, req or channel is null.");
            return;
        }
        req.getChannel().writeAndFlush(res);
    }

    @Override
    public void sendPack(Packet req, int mark) {
        if (null == req || null == req.getChannel()) {
            LogUtil.console.error("Oh no, req or channel is null.");
            return;
        }
        Packet res = new Packet(req, mark);
        req.getChannel().writeAndFlush(res);
    }

    @Override
    public void sendPack(Packet req, int mark, String msg) {
        if (null == req || null == req.getChannel()) {
            LogUtil.console.error("Oh no, req or channel is null.");
            return;
        }
        Packet res = new Packet(req, mark);
        res.put("msg", msg);
        req.getChannel().writeAndFlush(res);
    }
}
